import { View, Text,ScrollView } from '@tarojs/components'
import { useLoad,useReachBottom,usePullDownRefresh } from '@tarojs/taro'
import  styles  from  './index.module.less'
import { useState } from 'react'


 function Index () {
  const [refresh, setRefresh] = useState(false)

  //函数
  function onRefresherPulling() {
    // setRefresh(true)
    // setTimeout(() => {
    //   setRefresh(false)
    // }, 2000)
    console.log('refresherPulling');
  }
  function onRefresherRefresh(){
    console.log("onRefresherRefresh")
  }
  function onRefresherRestore() {
    console.log("onRefresherRestore")
  }
  function onScrollToLower() {
    console.log("onScrollToLower")
  }

  useLoad(() => {
    console.log('Page loaded.')
  })
  usePullDownRefresh(()=>{
    console.log("usePullDownRefresh")
  })
  useReachBottom(()=>{
    console.log("useReachBottom")
  })

  return (
    <View className='index'>
      <View className='border-red' style={{height:"1000px"}}>useReachBottom</View>
      {/* <ScrollView
      scrollY
      refresherEnabled
      refresherTriggered={refresh}
      className={styles.scroll}
      onRefresherPulling={onRefresherPulling}
      onRefresherRefresh={onRefresherRefresh}
      onRefresherRestore={onRefresherRestore}
      onScrollToLower={onScrollToLower}
      >
        <View style={{border:'1px solid red',height:'1000px'}}>555</View>
      </ScrollView> */}
    </View>
  )
}

export default Index
